<!-- /* Description for file.
 * 职位管理
 *
 * @copyright     Copyright 2008-2010, PHInfo Services Inc. (http://www.phinfoservices.com)
 * @package       ues
 * @subpackage    ues/app/views/recruitpositions
 * @since         ues
 * @version       V0.0.1
 * @modifiedby    张海杰2011年0618
 * @lastmodified  张海杰2011年0623
 */-->
 
 
 <script language="javascript">
var delurl="<?php echo $deleteurl; ?>";
</script>
<script language="javascript">
var editurl="<?php echo $editurl; ?>";
</script>
<script language="javascript">
var addurl="<?php echo $addurl; ?>";
</script>
<script language="javascript">
var data=<?php echo $data; ?>;
</script>
<script language="javascript">
var disbutton=<?php echo $javascript->object($disbutton);?>;
</script>
<script language="javascript">
var title2="<?php echo $title2; ?>";
</script>
<?php echo $javascript->link('jquery-1.4.2');?>
<script language="javascript">
var IND = IND1 = COM = '';
function button(com,grid,url)  
{  
	var ids=$("#flex").getCheckedRows();
	if(com=="delete")
	{
		var pids="";
		if(ids.length==0)
		{
			alert("请选择你要删除的项");
			return;
		}
		for(i=0;i<ids.length;i++)
        {
        	pids=pids+ids[i]+"/";
        }
		if(!confirm("确定删除?"))
			return;
		$.ajax({
            type: "post",
            url: url,
            data: {id:pids},
            dataType:"json",
            success: function(data) {
            $(".clearckeck").trigger("click");
			$(".pReload").trigger("click");
			$(".notice").html(data.message); 
			},
            error: function(data) {
				$(".clearckeck").trigger("click");
				$(".pReload").trigger("click");
				$(".notice").html('data.message');
			}
        });
	}
	else if(com=="add")
	{
		window.open(url);
	}
	else if(com=="edit")
	{
		if(ids.length!=1)
		{
			alert("请选择一个选项");
		}
		else
		{
			var seid=ids[0];
			var eurl=url+"/"+seid;
			window.open(eurl);
		}
	}
	else
	{
		var pix=com.substring(0,2);
		switch (pix)
		{
			case "aj":
				var pids="";
				if(ids.length==0)
				{
					alert("请选择选项");
					return;
				}
				for(i=0;i<ids.length;i++)
		        {
		        	pids=pids+ids[i]+"/";
		        }
				$.ajax({
		           type: "post",
		           url: url,
		            data: {id:pids},
		            dataType:"json",
		            success: function(data) {
					$(".pReload").trigger("click");
					$(".notice").html(data.message); 
					},
		            error: function(data) {
						$(".clearckeck").trigger("click");
						$(".pReload").trigger("click");
						$(".notice").html('data.message');
					}
		        });
				break;
			case "up":
				if(ids.length!=1)
				{
					alert("请选择一个选项");
				}
				else
				{
					var seid=ids[0];
					var eurl=url+"?id="+seid;
					window.open(eurl);
				}
				break;
			default:
				window.open(url);
		}
	}
}
$(document).ready(function(){
	$('#searchbtn').click(function(){
		var SC = $('#searchCompany').val();
		if(COM == ''){
			COM = getCOM();
		}
		if(COM=='')	return;
		var C_ary = COM.split('|#|');
		$("#zwcompany:eq(0)>option").remove();
		$("#zwcompany:eq(0)").append("<option></option>");
		$("#zwcompany:eq(0)>option:last").val("").html("不限");
		for(var i=0;i<C_ary.length;i++){
			var v = C_ary[i];
			if(v=='') continue;
			if(SC=='' || v.indexOf(SC.toUpperCase())!=-1 || v.indexOf(SC.toLowerCase())!=-1){
				$("#zwcompany:eq(0)").append("<option></option>");
				$("#zwcompany:eq(0)>option:last").val(v).html(v);
			}
		}
	});
	function getCOM(){
		var N_com = '';
		$('#zwcompany option').each(function(){
			N_com += $(this).val()+"|#|";
		});
		return N_com;
	}
});
</script>
<script type="text/javascript">
var b='';
/*[{
	name:'add',
	displayname : '添加',
	tp : '<?php echo ROOT_WEB_PATH; ?>/app/webroot/css/images/icons/add.png',
	bclass : 'add',
	onpress : button,
	display:disbutton.add,
	url:addurl
},
{
	// 设置分割线
	separator : true,
	display:disbutton.del
},
{
	name:'delete',
	displayname : '删除',
	tp : '<?php echo ROOT_WEB_PATH; ?>/app/webroot/css/images/icons/delete.png',
	bclass : 'delete',
	onpress : button,
	display:disbutton.del,
	url:delurl
},
{
	// 设置分割线
	separator : true,
	display:disbutton.del
},
{
	name:'edit',
	displayname : '更新',
	tp : '<?php echo ROOT_WEB_PATH; ?>/app/webroot/css/images/icons/edit.png',
	bclass : 'add',
	onpress : button,
	display:disbutton.edit,
	url:editurl
},
{
	// 设置分割线
	separator : true,
	display:disbutton.edit
}];*/
</script>
<script type="text/javascript">
var ob=<?php echo $ob;?>;
if(ob.length==0)
{
	
}
else
{
	for(i=0;i<ob.length;i++)
	{
		var l=b.length;
		b[l]=ob[i];
	}
}
</script>
<?php
	echo $html->css('flexigrid');
	echo $html->css('start/jquery-ui-1.8.2.custom');
	
	//echo $javascript->link('jquery');
	echo $javascript->link('flexigrid/flexigrid'); 
	echo $javascript->link('allinfo');
	//echo $javascript->link('DatePicker/WdatePicker');
	echo $javascript->link('jquery-ui-1.8.2.custom.min');
?>
<script type="text/javascript">
	$(function(){
		$(".datepickerSpan :input").datepicker({
			inline: true
		});
		 $('.datepickerSpan :input').datepicker('option', {dateFormat: "yy-mm-dd"});
		 $('.datepickerSpan :input').datepicker( "option", "closeText", 'X' );
		 
		
	});
	
</script>
<div id="flashMessage"></div>
<!-- 当前位置-->
<div id="tabmenubar">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabmenubartitle1"><?php echo  __('YourPosition');//您现在的位置：?></td>
		<td class="tabmenubartitle2"><?php echo __('Customer Managements');//一级目录
										   echo '>';?>
									<?php echo $html->tag('span', __('recruitpositions',true));//当前操作地用span加粗?> 						  
		</td>
	</tr>
</table>
</div>
<!-- 当前位置-->

<!--                                          按钮区域-->
<script type="text/javascript">
$(function(){
		$("#bt_0").click(function () {
			//$(".bt0").click();
			button('add','',addurl);
		});
		$("#bt_2").click(function () {
			//$(".bt2").click();
			button('delete','',delurl);
		});
		$("#bt_4").click(function () {
			//$(".bt4").click();
			button('edit','',editurl)
		});
		});
</script>
<div class="buttonbg">
<a class="btn2" id="bt_2">删除</a>
<a class="btn4" id="bt_0">添加职位</a>
<a class="btn4" id="bt_4">修改职位</a>
</div>
<!--                                         按钮区域--> 

<!--                                                                           查询区域-->
<div class="tabflex" id="selectview">
<fieldset><legend><?php echo __('recruitpositions')?></legend>
<?php if (count($searchitems)>0)
{
	$j=0;
	echo "<form class='searchform' name='searchform' action='#'>";
	for ($i=0;$i<count($searchitems);$i++)
	{
		$item=$searchitems[$i];

		if ($item['type']=="text")
		{
			echo $item['lable']."<input type='text' name='".$item['name']."' class='sitems' id='".$item['id']."' ></input>";
		}
		elseif ($item['type']=="select")
		{
			echo $item['lable']."<select name='".$item['name']."' class='sitems' id='".$item['id']."'>";
			foreach ($item['op'] as $k=>$v)
			{
				echo "<option value='$v'>$k</option>";
			}
			echo "</select>";
		}
		elseif ($item['type']=="checkbox")
		{
			echo "<input type='checkbox' name='".$item['name']."' class='sitems' id=".$item['id']. "value=".$item['value']." ></input>".$item['lable'];
		}
		elseif ($item['type']=="date")
		{
			echo $item['lable'];?><span class="datepickerSpan"><input type='text' name="<?php echo $item['name']?>" class='sitems' id='"<?php echo $item['id'];?>"' /></span>
		<?php 
		}elseif($item['type']=="button")
		{?>
		<input type="button" id="<?php echo $item['id'];?>" value="<?php echo $item['value'];?>" />
		<?php
		}
		if ($item['br'])
		{
			echo "<br>";
		}
	}
}
echo "<br><input type='submit' class='btn4' value='开始查询'/>";
echo "<input type='reset' class='btn4' value='清空条件'/>";
echo "</form>";
?>
</fieldset>
</div>
<!--                                                                           查询区域-->
<!--                                                                           表格-->
<div class="tabflex">
<table id="flex" style="display: none"></table><br></br>
</div>
<!--                                                                           表格-->



